﻿using System.Data;
using System.Data.SqlClient;
namespace MyWeb.Data
{
	public class tblCLASSDAL : SqlDataProvider
	{

		#region[tblCLASS_GetbyAll]
		public DataTable tblCLASS_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_tblCLASS_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCLASS_GetbyId]
		public DataTable tblCLASS_GetById(string CLASS_ID)
		{
			using (var cmd = new SqlCommand("sp_tblCLASS_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CLASS_ID", CLASS_ID));return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCLASS_GetbyTop]
		public DataTable tblCLASS_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_tblCLASS_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCLASS_GetbyCOURSE_ID]
		public DataTable tblCLASS_GetByCOURSE_ID(string COURSE_ID)
		{
			using (var cmd = new SqlCommand("sp_tblCLASS_GetByCOURSE_ID", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@COURSE_ID", COURSE_ID));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblCLASS_GetbySTAFF_ID]
		public DataTable tblCLASS_GetBySTAFF_ID(string STAFF_ID)
		{
			using (var cmd = new SqlCommand("sp_tblCLASS_GetBySTAFF_ID", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@STAFF_ID", STAFF_ID));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblCLASS_Insert]
		public void tblCLASS_Insert(tblCLASSInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblCLASS_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@STAFF_ID", Data.STAFF_ID));
				cmd.Parameters.Add(new SqlParameter("@COURSE_ID", Data.COURSE_ID));
				cmd.Parameters.Add(new SqlParameter("@CLASS_CODE", Data.CLASS_CODE));
				cmd.Parameters.Add(new SqlParameter("@CLASS_NAME", Data.CLASS_NAME));
				cmd.Parameters.Add(new SqlParameter("@START_DATE", Data.START_DATE));
				cmd.Parameters.Add(new SqlParameter("@END_DATE", Data.END_DATE));
				cmd.Parameters.Add(new SqlParameter("@STUDENT_COUNT", Data.STUDENT_COUNT));
				cmd.Parameters.Add(new SqlParameter("@STATUS", Data.STATUS));
				cmd.Parameters.Add(new SqlParameter("@CREATOR", Data.CREATOR));
				cmd.Parameters.Add(new SqlParameter("@CREATED_DATE", Data.CREATED_DATE));
				cmd.Parameters.Add(new SqlParameter("@MODIFIER", Data.MODIFIER));
				cmd.Parameters.Add(new SqlParameter("@MODIFIED_DATE", Data.MODIFIED_DATE));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblCLASS_Update]
		public void tblCLASS_Update(tblCLASSInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblCLASS_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CLASS_ID", Data.CLASS_ID));
				cmd.Parameters.Add(new SqlParameter("@STAFF_ID", Data.STAFF_ID));
				cmd.Parameters.Add(new SqlParameter("@COURSE_ID", Data.COURSE_ID));
				cmd.Parameters.Add(new SqlParameter("@CLASS_CODE", Data.CLASS_CODE));
				cmd.Parameters.Add(new SqlParameter("@CLASS_NAME", Data.CLASS_NAME));
				cmd.Parameters.Add(new SqlParameter("@START_DATE", Data.START_DATE));
				cmd.Parameters.Add(new SqlParameter("@END_DATE", Data.END_DATE));
				cmd.Parameters.Add(new SqlParameter("@STUDENT_COUNT", Data.STUDENT_COUNT));
				cmd.Parameters.Add(new SqlParameter("@STATUS", Data.STATUS));
				cmd.Parameters.Add(new SqlParameter("@CREATOR", Data.CREATOR));
				cmd.Parameters.Add(new SqlParameter("@CREATED_DATE", Data.CREATED_DATE));
				cmd.Parameters.Add(new SqlParameter("@MODIFIER", Data.MODIFIER));
				cmd.Parameters.Add(new SqlParameter("@MODIFIED_DATE", Data.MODIFIED_DATE));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblCLASS_Delete]
		public void tblCLASS_Delete(string CLASS_ID)
		{
			using (var cmd = new SqlCommand("sp_tblCLASS_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CLASS_ID",CLASS_ID));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
	}
}